package com.py.custom.business.demo.feign.adapter;

import com.py.custom.business.demo.feign.channel.DingDingChannel;
import com.py.custom.business.demo.protocol.dto.MessageTaskDTO;
import com.py.custom.business.demo.protocol.dto.SendResultDTO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * description：钉钉适配器
 */
@Component
public class DingDingChannelAdapter implements ChannelAdapter {

    @Resource
    private DingDingChannel dingDingChannel;

    @Override
    public boolean supports(String clazz) {
        Class<DingDingChannelAdapter> channelAdapterClazz = DingDingChannelAdapter.class;
        return clazz.equals(channelAdapterClazz.getName());
    }

    @Override
    public SendResultDTO sendMessage(MessageTaskDTO messageTaskDto) {
        return dingDingChannel.doSendMessage(messageTaskDto);
    }
}
